<template>
    <el-dialog
               v-bind="$attrs"
               v-on="$listeners"
               :title="title"
               @open="onOpen"
               @close="onclose"
               :close-on-click-modal="false"
               :close-on-press-escape="false">
        <el-form :model="form">
            <el-form-item label="分析师" :label-width="formLabelWidth">
                <el-select v-model="form.admin_account" placeholder="请选择分析师">
                    <el-option v-for="item in data"
                               :key="item.admin_account"
                               :label="item.admin_name"
                               :value="item.admin_account">
                    </el-option>
                </el-select>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="cancel">取 消</el-button>
            <el-button type="primary" @click="sureManger">确 定</el-button>
        </div>
    </el-dialog>
</template>
<script>
    import * as api from '../utils/api'
    export default {
        name: "ZxAnalystsDialog",
        props:['data','userId'],
        data(){
            return{
                dialogFormVisible: false,
                form: {
                    admin_account: '',
                },
                formLabelWidth: '120px',
                title:''
            }
        },
        methods:{
            onOpen(){

            },
            cancel(){
                this.$emit('onclose')
                this.form.admin_account=''
            },
            sureManger(){
                this.$emit('onclose')
                this.axios({
                    url:api.POST_ADDANALYSTS,
                    method:'post',
                    data:{admin_account:this.form.admin_account,
                        user_id:this.userId.user_id},
                }).then(data=>{
                    this.$emit('newTableDataNot')
                    this.$emit('newTableData')
                }).catch(err=>{

                })
                this.form.admin_account=''
            },
            onclose(){
                this.$emit('onclose')
            }
        }
    }
</script>

<style scoped>

</style>